using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;

namespace Yoozoo.Gameplay.Liberty.AI.Node
{
    [Category("Ggame/Liberty")]
    public class NpcIsLowHp : AIConditionBaseNode
    {
        public int LowHpNum = 30;
        
        public BBParameter<float> interval = 0.1f;
        private float _timestamp = 0;

        protected override bool OnCheck()
        {
            bool result = false;
            
            float t = Time.time;
            if(t >= _timestamp + interval.value)
            {
                result = _entity.data.hp < LowHpNum;
                _timestamp = t;
            }
            
            return result;
        }
    }
}